import * as echarts from "echarts";
import { useEffect, useRef } from "react";

export default function index({option,height,width}){

    const domRef = useRef()
    const chartInit = (item)=>{
        const myChart = echarts.init(item.current);
        myChart.setOption(option);
    }
    useEffect(()=>{
        chartInit(domRef)
    },[])
    return(
        <div ref={domRef} style={{height:height,width:width}}></div>
    )
}